function service(){

this.name=null;
this.level=null;
this.type=null;
this.attribute = new Array();


}


function attributeObj(){

this.name=null;
this.aspect = new Array();

}

function aspectObj(){

this.name=null;
this.required;
this.readOnly;
this.visible;
this.defaultVal;
this.aspectList = new Array();

}

function aspectListObj(){

this.name=null;
this.aspectList = new Array();

}



function parseAspect(thisObj, target){

//alert(thisObj.attr('class'));

thisObj.find('.aspectItem').each(function(){

var aspect= new aspectObj();

$(this).find('.desc').each(function(){
	aspect.name=$(this).val();
});

$(this).find('.required').each(function(){
	aspect.required=$(this).is(':checked');
});

$(this).find('.readOnly').each(function(){
	aspect.readOnly=$(this).is(':checked');
});

$(this).find('.default').each(function(){
	aspect.defaultVal=$(this).val();
});





if($(this).hasClass('dropDownElement')){
 
 $(this).find('.dropDownElementList').each(function(){
 
 aspect.aspectList.push($(this).val());
 
 });
 
}

target.aspect.push(aspect);

});

}



function modalPanel(thisObj){

var obj=thisObj;



var txt='<div class="modal cancel fixedObj"><div class="modalContent"><span class="hide">[X]</span><div class="modalHeader"></div><div style="margin-top:8px;"><p><span class="addElement addCondition limitSize">Add New</span></p><p><span class="addElement limitSize" onclick="$(this).closest(\'.modal\').find(\'.hide\').trigger(\'click\');">Done</span></p><p><span class="addElement limitSize" onclick="$(this).closest(\'.modal\').find(\'.hide\').trigger(\'click\')">Cancel</span></p></div><div class="scroller">';

txt=txt+addCondition(obj);
txt=txt+'</div></div></div>';
$(obj).find('.dialogForm').each(function(){


	$(this).html(txt);

});

	
	}
	
	
	
	function addCondition(thisObj){
	
	
	var txt='<fieldset><span class="div remove">&nbsp;&nbsp;X&nbsp;&nbsp;</span><p><label>Depends On</label><select>';

var aspectOpts='';
$('body').find('.aspectItem').each(function(){
aspectOpts=aspectOpts+'<option>'+$(this).find('.desc').val()+'</option>';



});


txt=txt+aspectOpts+'</select></p><p><label>Condition</label><select><option>EQUALS</option><option>LESSER THAN</option><option>GREATER THAN</option></select></p><p><label>Value</label><input type="text"/></p></fieldset>';
	
	return txt;
	}

